﻿#include "DeviceMacDialog.h"
#include <QIntValidator>

DeviceMacDialog::DeviceMacDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);	
    dev = mac = 0;

    QIntValidator *l = new QIntValidator(this);
    l->setRange(1,255);

    ui.lineDevice->setValidator(l);
    ui.lineMac->setValidator(l);
}

DeviceMacDialog::~DeviceMacDialog()
{
}

void DeviceMacDialog::showEvent(QShowEvent *event)
{
    ui.lineDevice->setText(QString::number(dev));
    ui.lineMac->setText(QString::number(mac));
}

void DeviceMacDialog::on_btnOk_clicked()
{
    dev = ui.lineDevice->text().toInt();
    mac = ui.lineMac->text().toInt();
	accept();
}

void DeviceMacDialog::on_btnCancel_clicked()
{
	reject();
}